package com.yao.spider.core.util;

import java.io.IOException;
import java.util.Properties;

/**
 * Created by 单耀 on 2017/12/4.
 */
public class Config {

    //是否保存导数据库
    public static boolean dbEnable;

    public static String proxyPath;
    //书否使用用代理抓取
    public static boolean isProxy;

    public static String startURL;

    public static String startUserToken;
    //下载网页数
    public static int downloadPageCount;

    static {
        Properties properties = new Properties();
        try {
            properties.load(Config.class.getResourceAsStream("/config.properties"));
        } catch (IOException e) {
            e.printStackTrace();
        }
        dbEnable = Boolean.parseBoolean(properties.getProperty("db.enable"));
        proxyPath = properties.getProperty("prxyPath");
        isProxy = Boolean.valueOf(properties.getProperty("isProxy"));
        startURL = properties.getProperty("startURL");
        startUserToken = properties.getProperty("startUserToken");
        downloadPageCount = Integer.valueOf(properties.getProperty("downloadPageCount"));
    }
}
